<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>std.iterator</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "std.iterator";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/std.iterator.html" class="symbol">std.iterator</a></h1>
  
<div class="summary">This module is a port of a growing fragment of the <span class="d_psymbol"><i>
algorithm</i></span> header in Alexander Stepanov's
<a href="http://www.sgi.com/tech/stl/">Standard Template Library</a>.</div>
<p class="sec_header">Author:</p><a href="http://erdani.org">Andrei Alexandrescu</a>
<p class="sec_header">Note:</p>For now only iterators for built-in arrays are defined. Built-in
arrays are also considered ranges themselves. The iterator of a
built-in array <span class="d_psymbol"><i>T[]</i></span> is a pointer of type <span class="d_psymbol"><i>T*</i></span>. This may change
in the future.
<dl>
<dt class="decl">template <a class="symbol _template" name="Iterator" href="./htmlsrc/std.iterator.html#L57" kind="template" beg="57" end="60">Iterator</a><span class="tparams">(Range : T[], T)</span>; <a title="Permalink to this symbol" href="#Iterator" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L57">#</a></dt>
<dd class="ddef">
<div class="summary"><span class="d_psymbol"><i>Iterator!(Range)</i></span> or <span class="d_psymbol"><i>Iterator!(Collection)</i></span> is the type that
is able to iterate an object of type <span class="d_psymbol"><i>Range</i></span> or <span class="d_psymbol"><i>Collection</i></span>,
respectively. This defines <span class="d_psymbol"><i>Iterator!(T[])</i></span> to be <span class="d_psymbol"><i>T*</i></span> for all
types <span class="d_psymbol"><i>T</i></span>.</div>
<dl>
<dt class="decl">alias T* <a class="symbol _alias" name="Iterator.Iterator" href="./htmlsrc/std.iterator.html#L59" kind="alias" beg="59" end="59">Iterator</a>; <a title="Permalink to this symbol" href="#Iterator.Iterator" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L59">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">template <a class="symbol _template" name="ElementType" href="./htmlsrc/std.iterator.html#L66" kind="template" beg="66" end="69">ElementType</a><span class="tparams">(Range : T[], T)</span>; <a title="Permalink to this symbol" href="#ElementType" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L66">#</a></dt>
<dd class="ddef">
<div class="summary">The element type of a range. For a built-in array <span class="d_psymbol"><i>T[]</i></span>, the
element type is <span class="d_psymbol"><i>T</i></span>.</div>
<dl>
<dt class="decl">alias T <a class="symbol _alias" name="ElementType.ElementType" href="./htmlsrc/std.iterator.html#L68" kind="alias" beg="68" end="68">ElementType</a>; <a title="Permalink to this symbol" href="#ElementType.ElementType" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L68">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">bool <a class="symbol _function" name="isEmpty" href="./htmlsrc/std.iterator.html#L74" kind="function" beg="74" end="77">isEmpty</a><span class="tparams">(T)</span><span class="params">(T[] <em>r</em>)</span>; <a title="Permalink to this symbol" href="#isEmpty" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L74">#</a></dt>
<dd class="ddef">
<div class="summary">Returns <span class="d_psymbol"><i>true</i></span> if and only if the range <span class="d_psymbol"><i>r</i></span> is empty.</div></dd>
<dt class="decl">Iterator!(T[]) <a class="symbol _function" name="begin" href="./htmlsrc/std.iterator.html#L82" kind="function" beg="82" end="85">begin</a><span class="tparams">(T)</span><span class="params">(T[] <em>r</em>)</span>; <a title="Permalink to this symbol" href="#begin" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L82">#</a></dt>
<dd class="ddef">
<div class="summary">Returns an iterator to the beginning of the range <span class="d_psymbol"><i>r</i></span>.</div></dd>
<dt class="decl">Iterator!(T[]) <a class="symbol _function" name="end" href="./htmlsrc/std.iterator.html#L90" kind="function" beg="90" end="93">end</a><span class="tparams">(T)</span><span class="params">(T[] <em>r</em>)</span>; <a title="Permalink to this symbol" href="#end" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L90">#</a></dt>
<dd class="ddef">
<div class="summary">Returns an iterator just past the end of the range <span class="d_psymbol"><i>r</i></span>.</div></dd>
<dt class="decl">ElementType!(T[]) <a class="symbol _function" name="front" href="./htmlsrc/std.iterator.html#L101" kind="function" beg="101" end="105">front</a><span class="tparams">(T)</span><span class="params">(T[] <em>r</em>)</span>; <a title="Permalink to this symbol" href="#front" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L101">#</a></dt>
<dd class="ddef">
<div class="summary">Returns the front element of the range.</div>
<p class="sec_header">Preconditions:</p><span class="d_psymbol"><i>!isEmpty(r)</i></span></dd>
<dt class="decl">T[] <a class="symbol _function" name="range" href="./htmlsrc/std.iterator.html#L120" kind="function" beg="120" end="124">range</a><span class="tparams">(T)</span><span class="params">(T* <em>first</em>, T* <em>last</em>)</span>; <a title="Permalink to this symbol" href="#range" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L120">#</a></dt>
<dd class="ddef">
<div class="summary">Creates a range from a pair of iterators.</div>
<p class="sec_header">Precondition:</p><span class="d_psymbol"><i>last</i></span> must be reachable from <span class="d_psymbol"><i>first</i></span> (for pointers, both must
belong to the same memory chunk and <span class="d_psymbol"><i>last >= first</i></span>).</dd>
<dt class="decl">struct <a class="symbol _struct" name="Retro" href="./htmlsrc/std.iterator.html#L130" kind="struct" beg="130" end="138">Retro</a><span class="tparams">(R : E[], E)</span>; <a title="Permalink to this symbol" href="#Retro" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L130">#</a></dt>
<dd class="ddef">
<div class="summary">Type that reverses the iteration order of a range.</div>
<dl>
<dt class="decl">E[] <a class="symbol _variable" name="Retro.forward" href="./htmlsrc/std.iterator.html#L132" kind="variable" beg="132" end="132">forward</a>; <a title="Permalink to this symbol" href="#Retro.forward" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L132">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">Retro <a class="symbol _function" name="Retro.opCall" href="./htmlsrc/std.iterator.html#L133" kind="function" beg="133" end="137">opCall</a><span class="params">(E[] <em>range</em>)</span>; <span class="attrs">[<span class="stc">static</span>]</span> <a title="Permalink to this symbol" href="#Retro.opCall" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L133">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">Retro!(E[]) <a class="symbol _function" name="retro" href="./htmlsrc/std.iterator.html#L144" kind="function" beg="144" end="147">retro</a><span class="tparams">(E)</span><span class="params">(E[] <em>r</em>)</span>; <a title="Permalink to this symbol" href="#retro" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L144">#</a></dt>
<dd class="ddef">
<div class="summary">Returns a range that iterates <span class="d_psymbol"><i>r</i></span> backwards.</div></dd>
<dt class="decl">struct <a class="symbol _struct" name="Iterator:2" href="./htmlsrc/std.iterator.html#L149" kind="struct" beg="149" end="176">Iterator</a><span class="tparams">(R : Retro!(T), T)</span>; <a title="Permalink to this symbol" href="#Iterator:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L149">#</a></dt>
<dd class="ddef">
<dl>
<dt class="decl">Iterator!(T) <a class="symbol _variable" name="Iterator.it" href="./htmlsrc/std.iterator.html#L151" kind="variable" beg="151" end="151">it</a>; <a title="Permalink to this symbol" href="#Iterator.it" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L151">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="Iterator.opSubtract" href="./htmlsrc/std.iterator.html#L152" kind="function" beg="152" end="156">opSubtract</a><span class="tparams">(Iterator)</span><span class="params">(Iterator <em>rhs</em>)</span>; <a title="Permalink to this symbol" href="#Iterator.opSubtract" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L152">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="Iterator.opPreInc" href="./htmlsrc/std.iterator.html#L158" kind="function" beg="158" end="161">opPreInc</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#Iterator.opPreInc" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L158">#</a></dt>
<dd class="ddef">
<div class="summary">@@@BUG@@@</div></dd>
<dt class="decl">Iterator <a class="symbol _function" name="Iterator.opAdd" href="./htmlsrc/std.iterator.html#L162" kind="function" beg="162" end="167">opAdd</a><span class="params">(int <em>i</em>)</span>; <a title="Permalink to this symbol" href="#Iterator.opAdd" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L162">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="Iterator.opAddAssign" href="./htmlsrc/std.iterator.html#L168" kind="function" beg="168" end="171">opAddAssign</a><span class="params">(int <em>i</em>)</span>; <a title="Permalink to this symbol" href="#Iterator.opAddAssign" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L168">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">typeof(it[-1]) <a class="symbol _function" name="Iterator.opStar" href="./htmlsrc/std.iterator.html#L172" kind="function" beg="172" end="175">opStar</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#Iterator.opStar" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L172">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">Iterator!(Retro!(F)) <a class="symbol _function" name="begin:2" href="./htmlsrc/std.iterator.html#L178" kind="function" beg="178" end="183">begin</a><span class="tparams">(F)</span><span class="params">(Retro!(F) <em>range</em>)</span>; <a title="Permalink to this symbol" href="#begin:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L178">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">Iterator!(Retro!(F)) <a class="symbol _function" name="end:2" href="./htmlsrc/std.iterator.html#L185" kind="function" beg="185" end="190">end</a><span class="tparams">(F)</span><span class="params">(Retro!(F) <em>range</em>)</span>; <a title="Permalink to this symbol" href="#end:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L185">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">Iterator!(Retro!(F[])) <a class="symbol _function" name="rBegin" href="./htmlsrc/std.iterator.html#L196" kind="function" beg="196" end="199">rBegin</a><span class="tparams">(F)</span><span class="params">(F[] <em>range</em>)</span>; <a title="Permalink to this symbol" href="#rBegin" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L196">#</a></dt>
<dd class="ddef">
<div class="summary">Returns <span class="d_psymbol"><i>begin(retro(range))</i></span>.</div></dd>
<dt class="decl">Iterator!(Retro!(F[])) <a class="symbol _function" name="rEnd" href="./htmlsrc/std.iterator.html#L205" kind="function" beg="205" end="208">rEnd</a><span class="tparams">(F)</span><span class="params">(F[] <em>range</em>)</span>; <a title="Permalink to this symbol" href="#rEnd" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L205">#</a></dt>
<dd class="ddef">
<div class="summary">Returns <span class="d_psymbol"><i>end(retro(range))</i></span>.</div></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest" href="./htmlsrc/std.iterator.html#L212" kind="unittest" beg="212" end="221">unittest</a>; <a title="Permalink to this symbol" href="#unittest" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.iterator.html#L212">#</a></dt>
<dd class="ddef"></dd></dl>
</div>
<div id="footer">
  <p>Copyright © 1999-2008 by Digital Mars ®, All Rights Reserved.</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Sun Dec 28 04:26:40 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>